import cgi

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db

import urllib
from google.appengine.api import urlfetch

import sys,os
import httplib
import re
import string

import datastore
import library
import datetime 
from datetime import date

from google.appengine.api import mail

#class Tournament(db.Model):



class MainPage(webapp.RequestHandler):


  def get(self):



   mail.send_mail(sender="roger <roger.okamoto@gmail.com>",
              to="Roger Okamoto <tennis.mutt@gmail.com>",
              subject="USTA Leagues",
              body="""
              Dear Albert:
               Please let us know if you have any questions.

              The example.com Team
              """)


   self.response.headers['Content-Type'] = 'text/html'
 
   f = open ('./patc.csv','r')
   count=0
   for eachLine in f:
      count=count+1
      if(count==1): continue
      if(count>20): break
      s = eachLine.split(',')
      First = s[0]
      Last = s[1]
      Year = s[2]
      Since = s[3]
      Email = s[4]
      Url = s[5]
      Address = s[6]
      City = s[7]
      State = s[8]
      Zip = s[9]
      AreaCode = s[10]
      Phone = s[11]
      Gender = s[12]
      Rating = s[13]
      NetNotes = s[14]
      Playtime = s[15]
      Help = s[16]
      Interest  = s[17] 
      print( First,Last,Year,Email,Url)

application = webapp.WSGIApplication(
                                     [('/read', MainPage)],
                                     debug=True)


def main():
    run_wsgi_app(application)

if __name__ == "__main__":

#   print __file__
#   print __name__

    main()
